import { Decorator } from "./decorator/Decorator";
import Http from "./http/Http";
import { AudioMgr } from "./manager/AudioMgr";
import { ControllerMgr } from "./manager/ControllerMgr";
import { DataMgr } from "./manager/DataMgr";
import LogMgr from "./manager/LogMgr";
import NetMgr from "./manager/NetMgr";
import { NodePoolMgr } from "./manager/NodePoolMgr";
import ProcedureMgr from "./manager/ProcedureMgr";
import ResMgr from "./manager/ResMgr";
import { TipsMgr } from "./manager/TipsMgr";
import UIMgr from "./manager/UIMgr";
import { TimeUtils } from "./utils/TimeUtils";
import Utils from "./utils/Utils";

export default class gfw {
    /** 流程控制管理 */
    static procedure: ProcedureMgr = null;
    /** 控制层管理 */
    static ctrl: ControllerMgr = null;
    /** 数据层管理 */
    static data: DataMgr = null;
    /** ui管理 */
    static ui: UIMgr = null;
    /** 资源管理 */
    static res: ResMgr = null;
    /** 日志管理 */
    static logMgr: LogMgr = null;
    /** http */
    static http: Http = null;
    /** net */
    static net: NetMgr = null;
    /** 提示管理 */
    static tips: TipsMgr = null;
    /** 工具类 */
    static utils: Utils = null;
    /** 对象池 */
    static nodePool: NodePoolMgr = null;
    /** 装饰器 */
    static decorator: Decorator = Decorator.inst;
    /** 音效 */
    static audio: AudioMgr = null;
    /** 时间工具 */
    static time: TimeUtils = null;

    static init() {
        this.procedure = ProcedureMgr.inst;
        this.ui = UIMgr.inst;
        this.res = ResMgr.inst;
        this.logMgr = LogMgr.inst;
        this.http = Http.instance;
        this.net = NetMgr.inst;
        this.ctrl = ControllerMgr.inst;
        this.data = DataMgr.inst;
        this.tips = TipsMgr.inst;
        this.utils = Utils.inst;
        this.nodePool = NodePoolMgr.inst;
        this.time = new TimeUtils()
        this.audio = new AudioMgr();
        // this.decorator = Decorator.inst;
    }

    static destroy() {
        this.procedure.destroy();
        this.ui.destroy();
        this.res.destroy();
        this.logMgr.destroy();
        this.net.destroy();
        this.ctrl.destroy();
        this.data.destroy();
        this.tips.destroy();
        this.utils.destroy();
        this.nodePool.destroy();
        this.decorator.destroy();
    }

    static update(dt: number) {
        this.procedure.update(dt);
        this.data.update(dt);
    }
}